home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Examples / TclCalculator / English.lproj / controls.nib / data.nib (.txt) < prev   
Encoding:
NeXT TypedStream Data  |  1995-03-22  |  3.7 KB  |  64 lines

  1. typedstream
  2. IBObjectData
  3. Object
  4. CustomObject
  5. WWTCLInterp
  6. WindowTemplate
  7. iiii***@s@
  8. some startup tcl code
  9. Panel
  10.     Responder
  11. ScrollView
  12. ClipView
  13. ciifffcfffs
  14. [618c]{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
  15. \margl40
  16. \margr40
  17. \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f0\b0\i0\ulnone\fs24\fc0\cf0 \
  18. proc calculateFarenheit \{\} \{\
  19.   global celsiusValue farenheitValue\
  20.   set tmp [expr \{9.0 * $celsiusValue\}]\
  21.   set tmp [expr \{$tmp / 5.0\}]\
  22.   set farenheitValue [expr \{$tmp + 32.0\}]\
  23. proc calculateCelsius \{\} \{\
  24.   global celsiusValue farenheitValue\
  25.   set tmp [expr \{$farenheitValue - 32.0\}]\
  26.   set tmp [expr \{$tmp * 5.0\}]\
  27.   set celsiusValue [expr \{$tmp / 9.0\}]\
  28. set celsiusValue 0\
  29. calculateFarenheit\
  30. NXCursor
  31. NXImage
  32. NXibeam
  33. Scroller
  34. Control
  35. _doScroller:
  36. @@@ffs
  37.     TextField
  38. TextFieldCell
  39. ActionCell
  40. `this is the tcl code which gets parsed by the tcl interpreter when it reads this nib file in.  It knows to do this because this text field is connected to the File's Owner's initalizationText outlet.  For fun, you might muck about with this code and break it.  What happens when you load it in?  Can you think of better behavior?  If so, let me know...
  41.     Helvetica
  42. WWTextField
  43. WWTextFieldCell
  44. 'set celsiusValue %f; calculateFarenheit
  45. celsiusValue
  46. Celsius:
  47. Helvetica-Bold
  48. 'set farenheitValue %f; calculateCelsius
  49. farenheitValue
  50. 5this Panel contains two UI objects which interact with the tcl interpreter that reads this nib file in.  Note that the tcl interp knows about these UI controls NOT because they are explicitly connected to the File's owner, but rather because the panel that they're on is (via the controlPanel outlet).
  51. What's especially neat is that by directly inspecting the object in IB, you can see not only what msg it sends when it gets manipulated, but also what value it is dependent on.  This is in stark contrast to the normal way things work in IB where you could only see the message the object sends, and you would have to magically figure out who had connected to this object as one of their outlets.  You would then have to examine that object to find what msgs it sent to that outlet at what times.
  52. With the tcl way of doing things, whenever the expression that a UI object depends on changes, for any reason, a message is sent to each UI element that depends on that variable, and the UI element reevaluates itself in the current context of the tcl interp.  Pretty neat, huh?
  53. Farenheit:
  54. Universal Calculator
  55. controls panel
  56. File's Owner
  57. tcl code
  58. IBOutletConnector
  59. IBConnector
  60. initializationText
  61. controlPanel
  62. delegate
  63. accessoryPanel0
  64.